feat(embedding): declare a model's width without sending dimensions - #1857
Open
NullSense wants to merge 1 commit into
Open
feat(embedding): declare a model's width without sending dimensions#1857NullSense wants to merge 1 commit into
NullSense wants to merge 1 commit into
Conversation
Ayush7614
approved these changes
Aug 22, 2026
Ayush7614
left a comment
Contributor
There was a problem hiding this comment.
Verified: pytest tests/unit/test_persistence/test_openai_embedder.py -q 52 passed. Correctly adds declared_dimensions/REPOWISE_EMBEDDING_DECLARED_DIMS as declare-only width (never sent as dimensions param) for non-Matryoshka models like Nemotron-3-Embed-1B that 400 on dimensions. Precedence dimensions > REPOWISE_EMBEDDING_DIMS > declared_dimensions > REPOWISE_EMBEDDING_DECLARED_DIMS > _DIMS > 1536 matches spec, error messages now name the actual source, and the strict-endpoint regression test proves the param is never sent. LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAIEmbeddercan only override an embedding model's width by also sending that width to the API as thedimensionsparameter. That's correct for a Matryoshka model, but it breaks a model of non-default width that isn't Matryoshka-capable: the API rejects the request outright (e.g. nvidia/Nemotron-3-Embed-1B, 2048-wide, served OpenAI-compatible, errors with "does not support Matryoshka embeddings; dimensions must be unset").declared_dimensions/REPOWISE_EMBEDDING_DECLARED_DIMS, a second override that sets the declared width without ever sending it. Precedence:dimensions=>REPOWISE_EMBEDDING_DIMS>declared_dimensions=>REPOWISE_EMBEDDING_DECLARED_DIMS> the_DIMStable > 1536. Only the first two are ever sent on the wire._DIMSorREPOWISE_EMBEDDING_DIMS.Related Issues
None.
Test Plan
uv run pytest tests/unit/test_persistence/test_openai_embedder.py -q— 52 passeduv run pytest tests/unit/test_persistence/ tests/unit/test_providers/ tests/unit/server/mcp/test_embedder_resolution.py tests/unit/cli/test_embedder_key_resolution.py -q— 416 passeduv run ruff check .(the actual CI lint gate;ruff format --checkisn't run in CI, and this PR's files are clean under it anyway)uv run repowise risk main..HEAD:impacted-tests/health --fileneed a completedrepowise initagainst this clone; that indexing run did not finish in time and is omitted rather than faked.)Why this shape, not a
_DIMStable entryThe straightforward fix is hardcoding
"nemotron-embed-1b": 2048in_DIMS. That covers exactly one deployment; every other non-Matryoshka model of non-default width hits the identical wall. The existingdimensions=design already treats width as something the operator declares for whatever model they're running, not something the code enumerates by name —declared_dimensionsextends that same idea to the one case it didn't cover.Checklist
Written with AI assistance; measurements and tests were run and verified locally.